public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}


class Solution {
    public boolean lemonadeChange(int[] bills) {
        int[] money = new int[2];
        for (int bill : bills) {
            bill = bill / 5;
            if (bill == 1) {
                money[0]++;
            } else if (bill == 2) {
                if (money[0] >= 1) {
                    money[1]++;
                    money[0]--;
                    continue;
                }
                return false;
            } else {
                if (money[1] >= 1 && money[0] >= 1) {
                    money[1]--;
                    money[0]--;
                    continue;
                } else if (money[0] >= 3) {
                    money[0] -= 3;
                    continue;
                }
                return false;
            }
        }
        return true;
    }
}